<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>区域管理</title>
<link rel="stylesheet" type="text/css" href="/widget/bootstrap/2.1.1/css/bootstrap.css">  
<link rel="stylesheet" type="text/css" href="res/css/theme.css"> 
<link rel="stylesheet" href="/widget/font-awesome1/css/font-awesome.css">
<script src="/ppf/js/jquery-1.min.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<script src="/ppf/js/jquery.base64.js" type="text/javascript"></script>    
<script src="/ppf/js/runpage.js" type="text/javascript"></script>
<script src="/ppf/js/bskdo.js" type="text/javascript"></script> 
<script src="/ppf/js/fun.js" type="text/javascript"></script>
<script src="/ppf/js/select.js" type="text/javascript"></script>
<script src="res/js/bskdlg.js" type="text/javascript"></script>
<script src="/widget/bootstrap/2.1.1/js/bootstrap.js"></script>
<style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>
<link rel="stylesheet" type="text/css" href="/widget/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/widget/easyui/themes/icon.css"> 
<script type="text/javascript" src="/widget/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/html/system/res/js/tree.js"></script>  
</head>

<body>
   <div>         
        <h4>区域管理中心 </h4>          
        <div class="container-fluid">
            <div class="row-fluid">
                    
            <div class="btn-toolbar">
            <div class="btn-group">  
                <button class="btn btn-primary" id="btn1" onclick="addTreeRootNode({tree:'#tree',dlg:'#dlg1'})">添加根</button>
                <button class="btn btn-primary" id="btn2" onclick="addTreeNode({tree:'#tree',dlg:'#dlg1'});">添加叶子</button>
                <a class="btn btn-primary" onclick="modTreeNode({tree:'#tree',dlg:'#dlg2'});getodx();" id="btn3">重命名</a>
                <button class="btn btn-primary" id="btn3" onclick="delTreeNode({tree:'#tree'});">删除分类</button> 
                <button class="btn btn-primary" id="btn3" onclick="updPidlist();">更新pidlist</button> 
                <a class="btn btn-waring" onclick="location.reload();">刷新</a>   
                </div>       
            </div>
            <div class="well">
            <div id="myTabContent" class="tab-content">
            <div class="tab-pane active in" id="home">  
            <ul class="easyui-tree" id="tree" data-options="lines:true"	url="/html/system/srv/gdo.php?tpl=sys_area"></ul>         
            </div>    
            </div>    
            </div>  
                    
            </div>
        </div>
    </div>      
</body>
</html>

<script>
    var dotype = "m";
    var tbl="sys_area";
    $(function () {
       //readID({ "tpl": queryStr("t"), "do": "r", "id": "1", frmid: "#form1" });        
    }); 
  function updPidlist(){
      var t = $("#tree");
      var node = t.tree('getSelected');
       if(node==undefined){alert("请选择一个节点1");return false;}
	   if(!node||node==null){alert("请选择一个节点2");return false;}
     if(!node.id||node.id==null){alert("节点id为空，请刷新后再试");return;}
		 //obj.href="t.php?t="+node.id+"&htm=0&gen=1&type="+type;
     $.post("/html/system/srv/areado.php", {tpl:"updpidlist",tbl:"sys_area",id:node.id}, function (e,f) {
        alert(e);
     });
  }
	function getodx(){
	   var t = $("#tree");
     var node = t.tree('getSelected'); 	
	   if(node==undefined){return;}
	   if(!node||node==null){return;}	
		 $.post("/html/system/srv/areado.php", {tpl:"getodx",tbl:"sys_area",id:node.id}, function (e,f) {
		 $("#dlg2 #odx").val($.trim(e));}); 		 
	}
</script>

<div class="modal small hide" id="dlg1" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="label">节点</h3>
    </div>
    <div class="modal-body">
<form id="form1">
<label>节点名称</label>  <input id="name" type="text" value="" maxlength="30"> 
 <label>排序(数字从小到大排序)</label>  <input id="odx" type="text" value="0"  onkeyup="value=value.replace(/[^0-9]/ig,'')">  
 <input type="text" id="id" style="display:none;" value="" disabled/>
</form> 
    </div>
    <div class="modal-footer">
        <button class="btn btn-danger" onclick="addTreeNodeDo('#dlg1')">确认</button>
        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
        
    </div>
</div>

<div class="modal small hide" id="dlg2" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="label">修改</h3>
    </div>
    <div class="modal-body">
<form id="form1">
<label>节点名称</label>  <input id="name" type="text" value="" maxlength="30"> 
<label>排序(数字大在前)</label>  <input id="odx" type="text" value="0"  onkeyup="value=value.replace(/[^0-9]/ig,'')" >   
 <input type="text" id="id" style="display:none;" value=""/>
</form> 
    </div>
    <div class="modal-footer">
        <button class="btn btn-danger" onclick="modTreeNodeDo('#dlg2')">确认</button>
        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
        
    </div>
</div>

